package com.yanmk.order.controller;

import com.yanmk.order.bean.Order;
import com.yanmk.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: cloud-demo
 * @description:
 * @author: Mr.Yan
 * @create: 2025-02-04 16:45
 **/
@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    // 创建订单
    @GetMapping("/create")
    public Order createOrder(@RequestParam(value = "userId") Long userId, @RequestParam(value = "productId") Long productId) {
        // TODO: 实现订单创建逻辑
        Order order = orderService.createOrder(productId, userId);
        return order;
    }
}
